#include <bits/stdc++.h>

using namespace std;

int a[4]={0};

int judge(int x){
	if(x%7==0)return 1;
	while(x>0){
		int tmp=x%10;
		if(tmp==7)return 1;
		x/=10;
	}
	return 0;
}

int main(int argc, char const *argv[])
{
	/* code */
	int n;scanf("%d",&n);
	int cnt=0,i=1;
	while(cnt<n){
		if(judge(i)){
			int turn=i%4;
			a[turn]++;
		}else cnt++;
		i++;
	}
	for(int i=1;i<4;i++){
		printf("%d\n",a[i]);
	}
	printf("%d\n",a[0]);
	return 0;
}